<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>购买</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        .center {
            text-align: center;
            color: #fff;
            font-size: 14px;
            position: fixed;
            top: 30%;
            left: 0px;
            right: 0px;
        }

        .goumai {
            background: #f39800;
            margin: 0 auto;
            display: inline-block;
            height: 30px;
            font-size: 16px;
            font-weight: bold;
            line-height: 30px;
            width: 80px;
            border-radius: 15px;
            margin-top: 20px;
        }

        body {
            background-color: rgba(0, 0, 0, 0.7);
        }

        .nonevip {
            width: 220px;
            margin: 0 auto;
        }

        .kaitong2 {
            background: #00a0e9;
            margin: 0 auto;
            display: inline-block;
            height: 30px;
            font-size: 16px;
            font-weight: bold;
            line-height: 30px;
            width: 80px;
            border-radius: 15px;
            margin-top: 20px;
            float: left;
        }

        .goumai2 {
            background: #f39800;
            margin: 0 auto;
            display: inline-block;
            height: 30px;
            font-size: 16px;
            font-weight: bold;
            line-height: 30px;
            width: 80px;
            border-radius: 15px;
            margin-top: 20px;
            float: right
        }

        .hide {
            display: none;
        }
        .clear{
          clear: both;
        }
    </style>
</head>

<body>
    <div id="vm" v-cloak v-show="xianshi">
        <div class="center" v-if='isvip'>
            <div v-html="shuyu"></div>
            <div class="goumai" @click="vipbuyvideo()" v-html="goumaiyin"></div>
        </div>
        <div class="center" v-else-if="isdakavideo">
            <div v-html="shuyu"></div>
            <div class="goumai" @click="novipbuyvideo()" v-html="goumaiyin"></div>
        </div>
        <div class="center" v-else-if="isvipvideo">
            <div v-html="shuyu"></div>
            <div class="nonevip">
                <div class="kaitong2" @click="buyvip()" v-html="kaitong"></div>
                <div class="goumai2" @click="novipbuyvideo1()" v-html="goumaiyin"></div>
                <div class="clear"></div>
            </div>
        </div>
        <div class="center" v-else>
            <div v-html="shuyu"></div>
            <div class="nonevip">
                <div class="kaitong2" @click="buyvip()" v-html="kaitong"></div>
                <div class="goumai2" @click="novipbuyvideo()" v-html="goumaiyin"></div>
                <div class="clear"></div>

            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/rest.js"></script>
<script type="text/javascript" src="../../script/vue.2.5.js"></script>
<script type="text/javascript" src="../../script/faskclick.js"></script>
<script type="text/javascript">
    var uid = $api.getStorage('uid')
    var vm = new Vue({
        el: '#vm',
        data: {
            daojishi: 30,
            isvip: false,
            isdakavideo: false,
            isvipvideo:false,
            xianshi:false,
            shuyu:'试看结束,您可以通过以下方式观看完整影片',
            goumaiyin:"购买影片",
            kaitong:'开通VIP'
        },
        created: function() {
            var _this = this;
            apiready = function() {

                api.parseTapmode();
                if ('addEventListener' in document) {
                    document.addEventListener('DOMContentLoaded', function() {
                        FastClick.attach(document.body);
                    }, false);
                }
                api.bringFrameToFront({
                    from: 'fanhui'
                });
                api.bringFrameToFront({
                    from: 'videocontrl'
                });
                api.addEventListener({
                    name: 'goumaiwan'
                }, function(ret, err){
                    api.closeFrame();

                });
                _this.init();
            }
        },
        methods: {
            init: function() {
                var _this = this;
                // alert(JSON.stringify(api.pageParam.videodetail));
                if (api.pageParam.videodetail.video_type == 3) {
                    _this.isdakavideo = true;
                }else if(api.pageParam.videodetail.video_type == 2){
                  _this.isvipvideo = true;
                }
                if(uid){
                  new rest().get('getUserInfo').datae({
                      uid: uid
                  }).success(function(res) {
                      if (res.msg[0].level == 1) {
                          _this.isvip = true
                      }
                      setTimeout(function() {
                        _this.xianshi =true
                      },400)
                  }).error(function(err) {
                      console.log(JSON.stringify(err))
                  }).run()
                }else {
                  setTimeout(function() {
                    _this.xianshi =true
                  },700)
                }

            },
            buyvip() {
                api.openWin({
                    name: 'unbuy_vip_win',
                    url: '../VIP/unbuy_vip_win.html',
                });
            },
            vipbuyvideo() {
               uid = $api.getStorage('uid');
                if (uid) {
                  api.openFrame({
                      name: 'undakavip_buyvideo',
                      url: '../VIP/undakavip_buyvideo.html',
                      rect: {
                          x: 0,
                          y: 0,
                          w: 'auto',
                          h: 'auto'
                      },
                      pageParam: {
                        videocash: api.pageParam.videodetail.video_free_cash,
                        videovipcash: api.pageParam.videodetail.video_vip_cash,
                        videoid: api.pageParam.videodetail.id,
                        riqi: api.pageParam.videodetail.endtime,
                        isyongjiu:api.pageParam.videodetail.is_forever,

                      },
                      bounces: false,
                      bgColor: 'rgba(0,0,0,0)',
                      vScrollBarEnabled: true,
                      hScrollBarEnabled: true
                  });
                } else {
                    api.openFrame({
                        name: 'login_introduction',
                        url: '../myself/login_introduction.html',
                        rect: {
                            x: 0,
                            y: 0,
                            w: 'auto',
                            h: 'auto'
                        },
                        bounces: false,
                        bgColor: 'rgba(0,0,0,0.7)',
                        vScrollBarEnabled: true,
                        hScrollBarEnabled: true
                    });
                }

            },
            novipbuyvideo1() {
                if (uid) {
                    api.openFrame({
                        name: 'unvip_buyvideo',
                        url: '../VIP/unvip_buyvideo.html',
                        rect: {
                            x: 0,
                            y: 0,
                            w: 'auto',
                            h: 'auto'
                        },
                        pageParam: {
                            videocash: api.pageParam.videodetail.video_free_cash,
                            videovipcash: api.pageParam.videodetail.video_vip_cash,
                            videoid: api.pageParam.videodetail.id,
                            riqi: api.pageParam.videodetail.endtime,
                            isyongjiu:api.pageParam.videodetail.is_forever,

                        },
                        bounces: false,
                        bgColor: 'rgba(0,0,0,0)',
                        vScrollBarEnabled: true,
                        hScrollBarEnabled: true
                    });
                } else {
                    api.openFrame({
                        name: 'login_introduction',
                        url: '../myself/login_introduction.html',
                        rect: {
                            x: 0,
                            y: 0,
                            w: 'auto',
                            h: 'auto'
                        },
                        bounces: false,
                        bgColor: 'rgba(0,0,0,0.7)',
                        vScrollBarEnabled: true,
                        hScrollBarEnabled: true
                    });
                }
            },
            novipbuyvideo() {
                if (uid) {
                    api.openFrame({
                        name: 'undakaunvip_buyvideo',
                        url: '../VIP/undakaunvip_buyvideo.html',
                        rect: {
                            x: 0,
                            y: 0,
                            w: 'auto',
                            h: 'auto'
                        },
                        pageParam: {
                            videocash: api.pageParam.videodetail.video_free_cash,
                            videovipcash: api.pageParam.videodetail.video_vip_cash,
                            videoid: api.pageParam.videodetail.id,
                            riqi: api.pageParam.videodetail.endtime,
                            isyongjiu:api.pageParam.videodetail.is_forever,

                        },
                        bounces: false,
                        bgColor: 'rgba(0,0,0,0)',
                        vScrollBarEnabled: true,
                        hScrollBarEnabled: true
                    });
                } else {
                    api.openFrame({
                        name: 'login_introduction',
                        url: '../myself/login_introduction.html',
                        rect: {
                            x: 0,
                            y: 0,
                            w: 'auto',
                            h: 'auto'
                        },
                        bounces: false,
                        bgColor: 'rgba(0,0,0,0.7)',
                        vScrollBarEnabled: true,
                        hScrollBarEnabled: true
                    });
                }
            }
        }
    })
</script>

</html>
